﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_XuatKhoList : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CboTinhTrang")]
        private ComboBox _CboTinhTrang;
        [AccessedThroughProperty("CmdAdd")]
        private ToolStripButton _CmdAdd;
        [AccessedThroughProperty("CmdDel")]
        private ToolStripButton _CmdDel;
        [AccessedThroughProperty("CmdEdit")]
        private ToolStripButton _CmdEdit;
        [AccessedThroughProperty("CmdExit")]
        private ToolStripButton _CmdExit;
        [AccessedThroughProperty("CmdHelp")]
        private ToolStripButton _CmdHelp;
        [AccessedThroughProperty("CmdPrint")]
        private ToolStripButton _CmdPrint;
        [AccessedThroughProperty("CmdRefresh")]
        private ToolStripButton _CmdRefresh;
        [AccessedThroughProperty("CmdSeachMaHang")]
        private Button _CmdSeachMaHang;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("TextBox1")]
        private TextBox _TextBox1;
        [AccessedThroughProperty("ToolStrip1")]
        private ToolStrip _ToolStrip1;
        [AccessedThroughProperty("ToolStripLabel1")]
        private ToolStripLabel _ToolStripLabel1;
        [AccessedThroughProperty("ToolStripSeparator1")]
        private ToolStripSeparator _ToolStripSeparator1;
        [AccessedThroughProperty("ToolStripSeparator2")]
        private ToolStripSeparator _ToolStripSeparator2;
        [AccessedThroughProperty("ToolStripSeparator3")]
        private ToolStripSeparator _ToolStripSeparator3;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtMaHang")]
        private TextBox _TxtMaHang;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSHangHoa")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSHangHoa;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        public string cFrmKhoa;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private DataView objData;
        private clsXuatKho objXK;

        public Frm_XuatKhoList()
        {
            base.KeyDown += new KeyEventHandler(this.Frm_PhieuThuList_KeyDown);
            base.Load += new EventHandler(this.Frm_PhieuThuList_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.mAllowView = false;
            this.mAllowDel = false;
            this.mAllowEdit = false;
            this.mAllowAdd = false;
            this.objXK = new clsXuatKho();
            this.cFrmKhoa = "";
            this.InitializeComponent();
        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_XuatKho.Dispose();
            MyProject.Forms.Frm_XuatKho.cFrmKhoa = "";
            MyProject.Forms.Frm_XuatKho.ShowDialog();
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            if (((this.VSlist.Rows.Count != 1) && (this.VSlist.Row > 0)) && (LVYModule.ConfirmDelete("") && this.objXK.DeleteData(Conversions.ToString(this.VSlist[this.VSlist.Row, 0]), 1)))
            {
                this.VSlist.RemoveItem(this.VSlist.Row);
            }
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            this.cFrmKhoa = Conversions.ToString(this.VSlist[this.VSlist.Row, 0]);
            if (this.cFrmKhoa.ToString().Trim() != "")
            {
                ReportModule.PrintXuatKhoHang(this.cFrmKhoa);
            }
        }

        private void CmdRefresh_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdSeachMaHang_Click(object sender, EventArgs e)
        {
            string expression = "";
            expression = SearchModule.SearchHangHoa("", modGeneral.H_STOCKID, "");
            if (expression.Trim() != "")
            {
                string[] strArray = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                this.TxtMaHang.Tag = strArray[0];
                this.TxtMaHang.Text = strArray[1];
            }
            else
            {
                this.TxtMaHang.Tag = "";
                this.TxtMaHang.Text = "";
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_PhieuThuList_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keyCode = e.KeyCode;
            if (keyCode == Keys.Escape)
            {
                this.Dispose();
            }
            else if (keyCode == Keys.F5)
            {
                this.CmdRefresh_Click(RuntimeHelpers.GetObjectValue(sender), e);
            }
            else if (keyCode == Keys.F8)
            {
                if (this.CmdAdd.Enabled)
                {
                    this.CmdAdd_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if (keyCode == Keys.F9)
            {
                if (this.CmdDel.Enabled)
                {
                    this.CmdDel_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if ((keyCode == Keys.F12) && this.CmdPrint.Enabled)
            {
                this.CmdPrint_Click(RuntimeHelpers.GetObjectValue(sender), e);
            }
        }

        private void Frm_PhieuThuList_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.CmdAdd.Enabled = this.mAllowAdd;
                this.CmdEdit.Enabled = this.mAllowEdit;
                this.CmdDel.Enabled = this.mAllowDel;
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                this.CboTinhTrang.Items.Clear();
                this.CboTinhTrang.Items.Add(modGeneral.Tranlated("Tất cả", ""));
                this.CboTinhTrang.Items.Add(modGeneral.Tranlated("Chưa ghi sổ", ""));
                this.CboTinhTrang.Items.Add(modGeneral.Tranlated("Đ\x00e3 ghi sổ", ""));
                this.CboTinhTrang.SelectedIndex = 0;
                this.LoadData();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_XuatKhoList));
            this.Label1 = new Label();
            this.TxtDenNgay = new DateTimePicker();
            this.ToolStripLabel1 = new ToolStripLabel();
            this.Panel1 = new Panel();
            this.Label3 = new Label();
            this.CmdSeachMaHang = new Button();
            this.TxtMaHang = new TextBox();
            this.Label13 = new Label();
            this.TxtTuNgay = new DateTimePicker();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel2 = new Panel();
            this.TextBox1 = new TextBox();
            this.CboDonVi = new ComboBox();
            this.ToolStripSeparator2 = new ToolStripSeparator();
            this.CmdPrint = new ToolStripButton();
            this.ToolStrip1 = new ToolStrip();
            this.CmdAdd = new ToolStripButton();
            this.CmdEdit = new ToolStripButton();
            this.CmdDel = new ToolStripButton();
            this.ToolStripSeparator3 = new ToolStripSeparator();
            this.CmdExit = new ToolStripButton();
            this.CmdHelp = new ToolStripButton();
            this.CmdRefresh = new ToolStripButton();
            this.ToolStripSeparator1 = new ToolStripSeparator();
            this.CboTinhTrang = new ComboBox();
            this.VSHangHoa = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1.SuspendLayout();
            this.VSlist.BeginInit();
            this.Panel2.SuspendLayout();
            this.ToolStrip1.SuspendLayout();
            this.VSHangHoa.BeginInit();
            this.SuspendLayout();
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            Point point = new Point(0x5c, 3);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            Size size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x3f;
            this.Label1.Text = "Đến ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Custom;
            point = new Point(0x60, 0x13);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x55, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x3e;
            this.ToolStripLabel1.Name = "ToolStripLabel1";
            size = new Size(0x29, 0x16);
            this.ToolStripLabel1.Size = size;
            this.ToolStripLabel1.Text = "Đơn vị";
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Label3);
            this.Panel1.Controls.Add(this.CmdSeachMaHang);
            this.Panel1.Controls.Add(this.TxtMaHang);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Dock = DockStyle.Top;
            point = new Point(0, 0x19);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x37e, 0x2b);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x42;
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            point = new Point(0xb8, 4);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x31, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 0x4d;
            this.Label3.Text = "M\x00e3 h\x00e0ng";
            this.CmdSeachMaHang.FlatStyle = FlatStyle.System;
            point = new Point(0x121, 0x12);
            this.CmdSeachMaHang.Location = point;
            this.CmdSeachMaHang.Name = "CmdSeachMaHang";
            size = new Size(0x17, 0x16);
            this.CmdSeachMaHang.Size = size;
            this.CmdSeachMaHang.TabIndex = 0x4c;
            this.CmdSeachMaHang.Text = "...";
            this.CmdSeachMaHang.UseVisualStyleBackColor = true;
            point = new Point(0xbb, 0x13);
            this.TxtMaHang.Location = point;
            this.TxtMaHang.Name = "TxtMaHang";
            size = new Size(0x65, 20);
            this.TxtMaHang.Size = size;
            this.TxtMaHang.TabIndex = 0x4b;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            point = new Point(4, 2);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x3d;
            this.Label13.Text = "Từ ng\x00e0y";
            this.TxtTuNgay.Format = DateTimePickerFormat.Custom;
            point = new Point(7, 0x13);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x53, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 60;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0x44);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x37e, 0x147);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x43;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgbtleftblue;
            this.Panel2.Controls.Add(this.TextBox1);
            this.Panel2.Dock = DockStyle.Bottom;
            point = new Point(0, 0x18b);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x37e, 0x1a);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x44;
            point = new Point(2, 3);
            this.TextBox1.Location = point;
            this.TextBox1.Name = "TextBox1";
            size = new Size(0x62, 20);
            this.TextBox1.Size = size;
            this.TextBox1.TabIndex = 0;
            this.CboDonVi.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(0x12d, 2);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0xdf, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0x45;
            this.ToolStripSeparator2.Name = "ToolStripSeparator2";
            size = new Size(6, 0x19);
            this.ToolStripSeparator2.Size = size;
            this.CmdPrint.Image = (Image) manager.GetObject("CmdPrint.Image");
            this.CmdPrint.ImageTransparentColor = Color.White;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x25, 0x16);
            this.CmdPrint.Size = size;
            this.CmdPrint.Text = "&In";
            this.CmdPrint.ToolTipText = "F12 In phiếu xuất kho";
            this.ToolStrip1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgbluenoborder;
            this.ToolStrip1.Items.AddRange(new ToolStripItem[] { this.CmdAdd, this.CmdPrint, this.CmdEdit, this.ToolStripSeparator2, this.CmdDel, this.ToolStripSeparator3, this.CmdExit, this.CmdHelp, this.CmdRefresh, this.ToolStripSeparator1, this.ToolStripLabel1 });
            point = new Point(0, 0);
            this.ToolStrip1.Location = point;
            this.ToolStrip1.Name = "ToolStrip1";
            size = new Size(0x37e, 0x19);
            this.ToolStrip1.Size = size;
            this.ToolStrip1.TabIndex = 0x41;
            this.ToolStrip1.Text = "ToolStrip1";
            this.CmdAdd.Image = (Image) manager.GetObject("CmdAdd.Image");
            this.CmdAdd.ImageTransparentColor = Color.White;
            this.CmdAdd.Name = "CmdAdd";
            size = new Size(0x52, 0x16);
            this.CmdAdd.Size = size;
            this.CmdAdd.Text = "&Th\x00eam mới";
            this.CmdAdd.ToolTipText = "F8 Th\x00eam mới phiếu xuất kho";
            this.CmdEdit.Image = (Image) manager.GetObject("CmdEdit.Image");
            this.CmdEdit.ImageTransparentColor = Color.White;
            this.CmdEdit.Name = "CmdEdit";
            size = new Size(0x2e, 0x16);
            this.CmdEdit.Size = size;
            this.CmdEdit.Text = "&Sửa";
            this.CmdEdit.ToolTipText = "F2 Chỉnh sửa phiếu xuất kho";
            this.CmdEdit.Visible = false;
            this.CmdDel.Image = (Image) manager.GetObject("CmdDel.Image");
            this.CmdDel.ImageTransparentColor = Color.White;
            this.CmdDel.Name = "CmdDel";
            size = new Size(0x2f, 0x16);
            this.CmdDel.Size = size;
            this.CmdDel.Text = "&X\x00f3a";
            this.CmdDel.ToolTipText = "F9 X\x00f3a phiếu xuất kho";
            this.ToolStripSeparator3.Name = "ToolStripSeparator3";
            size = new Size(6, 0x19);
            this.ToolStripSeparator3.Size = size;
            this.CmdExit.Alignment = ToolStripItemAlignment.Right;
            this.CmdExit.Image = (Image) manager.GetObject("CmdExit.Image");
            this.CmdExit.ImageTransparentColor = Color.White;
            this.CmdExit.Name = "CmdExit";
            size = new Size(0x3a, 0x16);
            this.CmdExit.Size = size;
            this.CmdExit.Text = "Th&o\x00e1t";
            this.CmdExit.Visible = false;
            this.CmdHelp.Alignment = ToolStripItemAlignment.Right;
            this.CmdHelp.Image = (Image) manager.GetObject("CmdHelp.Image");
            this.CmdHelp.ImageTransparentColor = Color.Magenta;
            this.CmdHelp.Name = "CmdHelp";
            size = new Size(0x34, 0x16);
            this.CmdHelp.Size = size;
            this.CmdHelp.Text = "&Help";
            this.CmdRefresh.Image = (Image) manager.GetObject("CmdRefresh.Image");
            this.CmdRefresh.ImageTransparentColor = Color.White;
            this.CmdRefresh.Name = "CmdRefresh";
            size = new Size(0x42, 0x16);
            this.CmdRefresh.Size = size;
            this.CmdRefresh.Text = "Refresh";
            this.CmdRefresh.ToolTipText = "F5 Load lại dữ liệu";
            this.ToolStripSeparator1.Name = "ToolStripSeparator1";
            size = new Size(6, 0x19);
            this.ToolStripSeparator1.Size = size;
            this.CboTinhTrang.FormattingEnabled = true;
            point = new Point(0x21f, 2);
            this.CboTinhTrang.Location = point;
            this.CboTinhTrang.Name = "CboTinhTrang";
            size = new Size(100, 0x15);
            this.CboTinhTrang.Size = size;
            this.CboTinhTrang.TabIndex = 0x75;
            this.VSHangHoa.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSHangHoa.ColumnInfo = manager.GetString("VSHangHoa.ColumnInfo");
            this.VSHangHoa.Dock = DockStyle.Bottom;
            this.VSHangHoa.ExtendLastCol = true;
            this.VSHangHoa.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0x1a5);
            this.VSHangHoa.Location = point;
            Padding padding = new Padding(0);
            this.VSHangHoa.Margin = padding;
            this.VSHangHoa.Name = "VSHangHoa";
            this.VSHangHoa.Rows.Count = 1;
            this.VSHangHoa.Rows.DefaultSize = 0x11;
            size = new Size(0x37e, 0x94);
            this.VSHangHoa.Size = size;
            this.VSHangHoa.StyleInfo = manager.GetString("VSHangHoa.StyleInfo");
            this.VSHangHoa.TabIndex = 0x76;
            this.VSHangHoa.VisualStyle = VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x239);
            this.ClientSize = size;
            this.Controls.Add(this.CboTinhTrang);
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.CboDonVi);
            this.Controls.Add(this.ToolStrip1);
            this.Controls.Add(this.VSHangHoa);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.Name = "Frm_XuatKhoList";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "ST-0001";
            this.Text = "DANH SACH PHIEU XUAT KHO";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VSlist.EndInit();
            this.Panel2.ResumeLayout(false);
            this.Panel2.PerformLayout();
            this.ToolStrip1.ResumeLayout(false);
            this.ToolStrip1.PerformLayout();
            this.VSHangHoa.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        public void LoadData()
        {
            string strCondition = " LoaiChungTu = 'XK' AND NgayChungTu BETWEEN '" + LVYModule.Date2Char(this.TxtTuNgay.Text) + "' AND '" + LVYModule.Date2Char(this.TxtDenNgay.Text) + "'";
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                strCondition = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(strCondition + " AND KhoaDonVi = '", this.CboDonVi.SelectedValue), "'"));
            }
            if (this.CboTinhTrang.SelectedIndex == 1)
            {
                strCondition = strCondition + " AND GhiSo = 0";
            }
            if (this.CboTinhTrang.SelectedIndex == 2)
            {
                strCondition = strCondition + " AND GhiSo = 1";
            }
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.TxtMaHang.Tag), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                strCondition = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(strCondition + " AND XK.Khoa IN (SELECT Distinct KhoaPhieuXuat FROM ST_XuatKhoChiTiet WHERE KhoaHangHoa = '", this.TxtMaHang.Tag), "' AND (NgayXuat BETWEEN '"), LVYModule.Date2Char(this.TxtTuNgay.Text)), "' AND '"), LVYModule.Date2Char(this.TxtDenNgay.Text)), "'))"));
            }
            this.objData = new DataView(this.objXK.GetListXuatKho(strCondition));
            this.VSlist.DataSource = this.objData;
            this.VSlist.Cols[0].Visible = false;
            this.VSlist.Cols[1].Width = 100;
            this.VSlist.Cols[2].Width = 100;
            this.VSlist.Cols[3].Width = 100;
            this.VSlist.Cols[4].Width = 100;
            this.VSlist.Cols[5].Width = 100;
            this.VSlist[0, 1] = modGeneral.Tranlated("Số chứng từ", "");
            this.VSlist[0, 2] = modGeneral.Tranlated("Ng\x00e0y chứng từ", "");
            this.VSlist[0, 3] = modGeneral.Tranlated("T\x00e0i khoản", "");
            this.VSlist[0, 4] = modGeneral.Tranlated("Số tiền", "");
            this.VSlist[0, 5] = modGeneral.Tranlated("Quy đổi", "");
            this.VSlist[0, 6] = modGeneral.Tranlated("Diễn giải", "");
            this.VSlist.Cols[7].Visible = false;
            this.VSlist.Cols[4].DataType = System.Type.GetType("Decimal");
            this.VSlist.Cols[4].Format = modGeneral.H_FORMATNUMBER;
            this.VSlist.Cols[5].DataType = System.Type.GetType("Decimal");
            this.VSlist.Cols[5].Format = modGeneral.H_FORMATNUMBER;
            this.VSlist.Styles.Alternate.BackColor = ProfessionalColors.ToolStripGradientMiddle;
            if (this.VSlist.Rows.Count > 1)
            {
                this.VSlist.Select(1, 1);
            }
        }

        public void LoadDetailsHangHoa(string pKhoa)
        {
            DataTable listDetails = this.objXK.GetListDetails(pKhoa);
            if (listDetails != null)
            {
                this.VSHangHoa.Select(0, 1);
                this.VSHangHoa.Rows.Count = 1;
                int num2 = listDetails.Rows.Count - 1;
                for (int i = 0; i <= num2; i++)
                {
                    C1.Win.C1FlexGrid.C1FlexGrid vSHangHoa = this.VSHangHoa;
                    vSHangHoa.AddItem("");
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["Khoa"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["KhoaKho"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["KhoHang"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["KhoaHangHoa"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["Ma"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["HangHoa"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["SoLoHang"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["SoSeri"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["NgayNhap"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 9] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["HanSuDung"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 10] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["KhoaDonViTinh"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 11] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["DonViTinh"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 12] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["QuyCach"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 13] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["SoLuong"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 14] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["GiaVon"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 15] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["TienVon"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 0x10] = 0;
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 0x11] = 0;
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 0x12] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["KhoaTKHangHoa"]);
                    vSHangHoa[vSHangHoa.Rows.Count - 1, 0x13] = RuntimeHelpers.GetObjectValue(listDetails.Rows[i]["TaiKhoanHangHoa"]);
                    vSHangHoa = null;
                }
            }
        }

        public void SetLanguage()
        {
             IEnumerator enumerator=null;
             IEnumerator enumerator2=null;
            try
            {
                enumerator = this.Panel1.Controls.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    object objectValue = RuntimeHelpers.GetObjectValue(enumerator.Current);
                    if (Strings.Left(Conversions.ToString(NewLateBinding.LateGet(objectValue, null, "Name", new object[0], null, null, null)), 3).ToUpper() == "CMD")
                    {
                        NewLateBinding.LateSet(objectValue, null, "Text", new object[] { modGeneral.Tranlated(Conversions.ToString(NewLateBinding.LateGet(objectValue, null, "text", new object[0], null, null, null)), "") }, null, null);
                    }
                    if (Strings.Left(Conversions.ToString(NewLateBinding.LateGet(objectValue, null, "Name", new object[0], null, null, null)), 3).ToUpper() == "LAB")
                    {
                        NewLateBinding.LateSet(objectValue, null, "Text", new object[] { modGeneral.Tranlated(Conversions.ToString(NewLateBinding.LateGet(objectValue, null, "text", new object[0], null, null, null)), "") }, null, null);
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            try
            {
                enumerator2 = this.ToolStrip1.Items.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    object instance = RuntimeHelpers.GetObjectValue(enumerator2.Current);
                    if (Strings.Left(Conversions.ToString(NewLateBinding.LateGet(instance, null, "Name", new object[0], null, null, null)), 3).ToUpper() == "CMD")
                    {
                        NewLateBinding.LateSet(instance, null, "Text", new object[] { modGeneral.Tranlated(Conversions.ToString(NewLateBinding.LateGet(instance, null, "text", new object[0], null, null, null)), "") }, null, null);
                    }
                    if (Strings.Left(Conversions.ToString(NewLateBinding.LateGet(instance, null, "Name", new object[0], null, null, null)), 3).ToUpper() == "LAB")
                    {
                        NewLateBinding.LateSet(instance, null, "Text", new object[] { modGeneral.Tranlated(Conversions.ToString(NewLateBinding.LateGet(instance, null, "text", new object[0], null, null, null)), "") }, null, null);
                    }
                }
            }
            finally
            {
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
            }
            this.Text = modGeneral.Tranlated(this.Text, "");
            LVYModule.SetTitleGrid(this.VSlist);
        }

        public void setUserRight()
        {
            this.CmdAdd.Enabled = this.mAllowEdit;
            this.CmdEdit.Enabled = this.mAllowEdit;
            this.CmdDel.Enabled = this.mAllowDel;
        }

        private void TxtMaHang_LostFocus(object sender, EventArgs e)
        {
            string expression = "";
            if (this.TxtMaHang.Text.Trim() != "")
            {
                expression = SearchModule.SearchHangHoa(this.TxtMaHang.Text.Trim(), modGeneral.H_STOCKID, "");
                if (expression.Trim() != "")
                {
                    string[] strArray = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                    this.TxtMaHang.Tag = strArray[0];
                    this.TxtMaHang.Text = strArray[1];
                }
                else
                {
                    this.TxtMaHang.Tag = "";
                    this.TxtMaHang.Text = "";
                }
            }
            else
            {
                this.TxtMaHang.Tag = "";
                this.TxtMaHang.Text = "";
            }
        }

        private void TxtTuNgay_LostFocus(object sender, EventArgs e)
        {
            if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
            {
                this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
            }
        }

        private void VSlist_DoubleClick(object sender, EventArgs e)
        {
            if ((this.VSlist.Rows.Count != 1) && (this.VSlist.Row > 0))
            {
                MyProject.Forms.Frm_XuatKho.Dispose();
                MyProject.Forms.Frm_XuatKho.cFrmKhoa = Conversions.ToString(this.VSlist[this.VSlist.Row, 0]);
                MyProject.Forms.Frm_XuatKho.Show();
                MyProject.Forms.Frm_XuatKho.BringToFront();
                if (this.VSlist.Rows.Count != 1)
                {
                    this.objXK.Load(Conversions.ToString(this.VSlist[this.VSlist.Row, 0]));
                    this.VSlist[this.VSlist.Row, this.VSlist.Cols.Count - 1] = this.objXK.GhiSo;
                    this.VSlist_RowColChange(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
        }

        private void VSlist_RowColChange(object sender, EventArgs e)
        {
            if ((this.VSlist.Row > 0) && (this.VSlist.Col > 0))
            {
                if (Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[this.VSlist.Row, this.VSlist.Cols.Count - 1]), 0, modGeneral.TypeOfValue.Nothing)) == 1)
                {
                    this.CmdEdit.Enabled = false;
                    this.CmdDel.Enabled = false;
                }
                else
                {
                    this.CmdEdit.Enabled = true;
                    this.CmdDel.Enabled = true;
                }
            }
        }

        private void VSlist_SelChange(object sender, EventArgs e)
        {
            if ((this.VSlist.Rows.Count != 1) && (this.VSlist.Row > 0))
            {
                this.LoadDetailsHangHoa(Conversions.ToString(this.VSlist[this.VSlist.Row, 0]));
            }
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual ComboBox CboTinhTrang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboTinhTrang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboTinhTrang = value;
            }
        }

        internal virtual ToolStripButton CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdEdit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdEdit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdEdit = value;
            }
        }

        internal virtual ToolStripButton CmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdExit = value;
            }
        }

        internal virtual ToolStripButton CmdHelp
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdHelp;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdHelp = value;
            }
        }

        internal virtual ToolStripButton CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdRefresh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdRefresh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdRefresh_Click);
                if (this._CmdRefresh != null)
                {
                    this._CmdRefresh.Click -= handler;
                }
                this._CmdRefresh = value;
                if (this._CmdRefresh != null)
                {
                    this._CmdRefresh.Click += handler;
                }
            }
        }

        internal virtual Button CmdSeachMaHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdSeachMaHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdSeachMaHang_Click);
                if (this._CmdSeachMaHang != null)
                {
                    this._CmdSeachMaHang.Click -= handler;
                }
                this._CmdSeachMaHang = value;
                if (this._CmdSeachMaHang != null)
                {
                    this._CmdSeachMaHang.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual TextBox TextBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TextBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TextBox1 = value;
            }
        }

        internal virtual ToolStrip ToolStrip1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStrip1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStrip1 = value;
            }
        }

        internal virtual ToolStripLabel ToolStripLabel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripLabel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripLabel1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator2 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator3 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual TextBox TxtMaHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtMaHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtMaHang_LostFocus);
                if (this._TxtMaHang != null)
                {
                    this._TxtMaHang.LostFocus -= handler;
                }
                this._TxtMaHang = value;
                if (this._TxtMaHang != null)
                {
                    this._TxtMaHang.LostFocus += handler;
                }
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTuNgay_LostFocus);
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus -= handler;
                }
                this._TxtTuNgay = value;
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSHangHoa
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSHangHoa;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSHangHoa = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.VSlist_DoubleClick);
                EventHandler handler2 = new EventHandler(this.VSlist_SelChange);
                EventHandler handler3 = new EventHandler(this.VSlist_RowColChange);
                if (this._VSlist != null)
                {
                    this._VSlist.DoubleClick -= handler;
                    this._VSlist.SelChange -= handler2;
                    this._VSlist.RowColChange -= handler3;
                }
                this._VSlist = value;
                if (this._VSlist != null)
                {
                    this._VSlist.DoubleClick += handler;
                    this._VSlist.SelChange += handler2;
                    this._VSlist.RowColChange += handler3;
                }
            }
        }
    }
}

